package com.hue.gulimail.gulimailmember.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hue.common.utils.PageUtils;
import com.hue.gulimail.gulimailmember.entity.MemberEntity;
import com.hue.gulimail.gulimailmember.exception.EmailExistException;
import com.hue.gulimail.gulimailmember.exception.UsernameExistException;
import com.hue.gulimail.gulimailmember.exception.UsernamePasswordErrorException;
import com.hue.gulimail.gulimailmember.vo.LoginVo;
import com.hue.gulimail.gulimailmember.vo.OrderVo;
import com.hue.gulimail.gulimailmember.vo.RegisterVo;
import com.hue.gulimail.gulimailmember.vo.SocialUserVo;

import java.util.List;
import java.util.Map;

/**
 * 会员
 *
 * @author yaofengqiao
 * @email 451737523@qq.com
 * @date 2021-08-12 17:07:52
 */
public interface MemberService extends IService<MemberEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 注册用户
     *
     * @param registerVo
     */
    void register(RegisterVo registerVo) throws UsernameExistException, EmailExistException;

    /**
     * 判断用户名是否存在，存在时会抛出UsernameExistException
     *
     * @throws UsernameExistException
     */
    void usernameExist(String username) throws UsernameExistException;

    /**
     * 判断邮箱是否存在，存在时会抛出EmailExistException
     *
     * @throws EmailExistException
     */
    void emailExist(String email) throws EmailExistException;

    /**
     * 用户登录
     * @param loginVo
     * @return
     * @throws UsernamePasswordErrorException
     */
    MemberEntity login(LoginVo loginVo) throws UsernamePasswordErrorException;

    /**
     * 社交用户登录
     * @param socialUserVo
     * @return
     */
    MemberEntity login(SocialUserVo socialUserVo);

    /**
     * 查询用户的订单信息
     * @return
     */
    List<OrderVo> getOrders();

}

